package com.ruoyi.hqfinance.service.impl;

import com.github.pagehelper.PageHelper;
import com.ruoyi.hqfinance.domain.HqPaiFeeExamineSheet;
import com.ruoyi.hqfinance.domain.vo.HqPaiFeeExamineSheetVo;
import com.ruoyi.hqfinance.mapper.HqPaiFeeExamineSheetMapper;
import com.ruoyi.hqfinance.service.HqPaiFeeExamineSheetService;
import com.ruoyi.logistic.mapper.NetworkNameMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class HqPaiFeeExamineSheetServiceImpl implements HqPaiFeeExamineSheetService {
    @Autowired
    private HqPaiFeeExamineSheetMapper hqPaiFeeExamineSheetMapper;
    @Autowired
    private NetworkNameMapper networkNameMapper;
    @Override
    public List<HqPaiFeeExamineSheet> collect(HqPaiFeeExamineSheetVo vo) {
        PageHelper.startPage(vo.getPageDate());
        List<HqPaiFeeExamineSheet> paiFeeExamineSheets = hqPaiFeeExamineSheetMapper.collect(vo);
        assert paiFeeExamineSheets != null;
        for (HqPaiFeeExamineSheet hqPaiFeeExamineSheet : paiFeeExamineSheets){
            hqPaiFeeExamineSheet.setNetworkCode(networkNameMapper.selectCodeByName(hqPaiFeeExamineSheet.getName()));
            hqPaiFeeExamineSheet.setDate(vo.getStartTime() + "至" + vo.getEndTime());
        }
        return paiFeeExamineSheets;
    }
}
